﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;

namespace PeisongWeb
{
    public partial class seller_reportbusinessdetail : customerPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt;
                int companyid = logic.customer.getCompanyId();
                string ff = "";
                string rbno = "";

                if (Request.QueryString["ff"] != null)
                {
                    rbno = ff = Request.QueryString["ff"].ToString();
                }

                // 如果ff为""的话，表示预览供货单
                dt = DAL.reportBusiness.getDetailByRbNoCom(ff, companyid);

                ReportDataSource rds = new ReportDataSource("seller_reportdetail_DataTable1", dt);
                ReportViewer1.LocalReport.DataSources.Clear();


                ReportParameter rb_No = new ReportParameter("rb_No", (string.IsNullOrEmpty(ff) ? "" : "提货单号:" + ff));
                ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rb_No });
                ReportViewer1.LocalReport.DataSources.Add(rds);


                ReportViewer1.LocalReport.DataSources.Add(rds);
                ReportViewer1.LocalReport.Refresh();
                if (Request.QueryString["ff"] == null)
                    ReportViewer1.ShowPrintButton = false;
                if (dt.Rows.Count == 0)
                {
                    ReportViewer1.Visible = false;
                    div_nodata.Visible = true;
                }
                else
                {
                    ReportViewer1.Visible = true;
                    div_nodata.Visible = false;
                }
            }

        }

    }
}
